﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ThanhTu.GNCMedia.KQXS.DataAccess.DAL;
using ThanhTu.GNCMedia.KQXS.DataAccess.DO;

namespace WebUI.Admin
{
    public partial class UpdateSyntaxMessenger : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            lBLtenTinh.Text = "<font color='red'>" + Request.QueryString["PovinceName"] + "</font>";
            txt_tenTinhUpdate.Enabled = false;
            txt_tenTinhUpdate.Text = Request.QueryString["PROVINCEID"];
            lbl_oldSyntax.Text = "<font color='red'>" + Request.QueryString["Syntax"] + "</font>";
            old_switchboad.Text = "<font color='red'>" + Request.QueryString["SwitchBoard"] + "</font>";
        }

        protected void btn_UpdateSyntax_Click(object sender, EventArgs e)
        {
            MessengerSyntaxDAL messengerSyntax = new MessengerSyntaxDAL();
            MessengerSyntaxDO messengerDO = new MessengerSyntaxDO();
            messengerDO.ProvinceID =txt_tenTinhUpdate.Text;
            messengerDO.Syntax = txt_Syntax_update.Text;
            messengerDO.SwitchBoard = txt_tongDai_Syntax_update.Text;
            int checkInsert = messengerSyntax.add(messengerDO);
            if (checkInsert > 0)
            {
                Lbl_Requiment.ForeColor = System.Drawing.Color.Blue;
                Lbl_Requiment.Text = "Update CÚ PHÁP Tin Nhắn Thành công";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowStatus", "javascript:alert('Update CÚ PHÁP Tin Nhắn Thành công);", true);
            }
            else
            {
                Lbl_Requiment.ForeColor = System.Drawing.Color.Blue;
                Lbl_Requiment.Text = "LỖI Update ,XIN VUI LÒNG THỬ LẠI";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowStatus", "javascript:alert('LỖI Update ,XIN VUI LÒNG THỬ LẠI);", true);
            }
        }
    }
}